<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"> 
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>特征点统计</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<%@ include file="../jslib/jquerylib.jsp" %> 
	<link rel="stylesheet" type="text/css" href="<%=path %>/web/style/layout.css" />
    <script type="text/javascript" src="<%=path %>/jslib/jquery.validate.min.js"></script>
    <link rel="stylesheet" type="text/css" href="<%=path %>/web/style/layout.css" />
    <link rel="stylesheet" type="text/css" href="<%=request.getContextPath() %>/jslib/jquery-easyui-1.4.1/themes/default/easyui.css">
	<link rel="stylesheet" type="text/css" href="<%=request.getContextPath() %>/jslib/jquery-easyui-1.4.1/themes/icon.css">
	<link rel="stylesheet" type="text/css" href="<%=request.getContextPath() %>/jslib/jquery-easyui-1.4.1/demo.css">
	<script type="text/javascript" src="<%=request.getContextPath() %>/jslib/jquery-easyui-1.4.1/jquery.easyui.min.js"></script>
    
  </head>
  
  <body>
  	<table>
		<tr>
			<td >
				统计字段：
				<input id="fieldname" name="fieldname" class="easyui-combobox"  style="width:250px;height: 26px;"
			name="language"
			data-options="
					url:'<%=request.getContextPath() %>/tongji/tezhengdtype_data.json',
					method:'get',
					valueField:'id',
					textField:'text',
					multiple:true
				">	
			</td>
			<td >
				<input id="btntongji" type="button" value="统计" class="form_bt_orange" onclick="tongji()" />
				<input id="btnexpexcel" type="button" value="导出" class="form_bt_orange" onclick="expexcel()" />
			</td>
		</tr>
	</table>
	<table id="gridTable"></table>
	<div id="gridPager"></div>
    
  </body>
  <script type='text/javascript'>
  		var ishow = '${ishow}';
  		var fds = '${fieldname}';
		function tongji(){
			var fieldname= $('#fieldname').combobox('getValues');
			document.location.href = "<%=request.getContextPath() %>/tongjiAction!initTezhengd.action?fieldname="+fieldname;
		}
		
		$(document).ready(function(){
			if (ishow=='0'){
				return;
			}
			$('#fieldname').combobox('setValues','${fieldname}')
			var fieldname= $('#fieldname').combobox('getValues');
			var gxids = "";
			gxids = window.parent.getTreeSelectgx();
			if (gxids==''){
				alert('没有选择需要统计的管线!');
				return;
			}
			var swidth = document.body.clientWidth;
			$("#gridTable").jqGrid({
				url:'<%=request.getContextPath() %>/tongjiAction!tongjiTezhengd.action?fieldname='+fieldname+'&gxids='+gxids,
				datatype: "json",
				height: 300,
				width:swidth-10,
				colNames:['管线编号'${colNames}],
				colModel:[
					{name:'guanxianbh',index:'guanxianbh', width:250} 
					${colModel}
				],   
				shrinkToFit:false,
				sortname:'guanxianbh',
				sortorder:'asc',
				viewrecords:true,
				multiselect: true, // 是否显示复选框
				multiboxonly : true, 
				rownumbers: false,//显示行号
			    cellEdit: false,
				forceFit : true, 
				rowNum:200,
				mtype: "POST", 
				rowList:[15,20,50,200,500],
				toolbar: [false,"top"],
				jsonReader: {
					root:"rows",		// 数据行（默认为：rows）
					page: "page",  	// 当前页
					total: "total",  // 总页数
					records: "records",  // 总记录数
					repeatitems : false		// 设置成false，在后台设置值的时候，可以乱序。且并非每个值都得设
				},
				prmNames:{rows:"rows",page:"page",sort:"sidx",order:"sord",search:"search"},
				pager:"#gridPager",
				caption: "特征点统计"
			});
			jQuery("#gridTable").jqGrid('navGrid','#gridPager',{add:false,edit:false,del:false,search:false,refresh:false});

			
			jQuery("#gridTable").jqGrid('setGridParam',
			{
				url:'<%=request.getContextPath() %>/tongjiAction!tongjiTezhengd.action?fieldname='+fieldname+'&gxids='+gxids
			}).trigger("reloadGrid", [{page:1}]); 
		});
		
		function expexcel(){
			if (ishow=='0'){
				alert('请选择需要统计的字段!');
				return;
			}
			var fieldname= $('#fieldname').combobox('getValues');
			var gxids = "";
			gxids = window.parent.getTreeSelectgx();
			if (gxids==''){
				alert('没有选择需要统计的管线!');
				return;
			}
			window.open('<%=request.getContextPath() %>/tongjiAction!tongjiTezhengdexp.action?fieldname='+fieldname+'&gxids='+gxids);
		}
		  	 
	</script>
</html>
